<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
global $option;
if($this->err !="")
{
	echo $this->err;
	
}
?>
<form action="index2.php?option=<?php echo $option;?>" method="POST" name ="adminForm">
<table width="100%" class="contentpane">
<tr>
<th colspan="2">
<h3>
<?php echo JText::_('INVOICE')?>
</h3>
</th>
</tr>
<?php
$invoice =$this->invoice ;
for($i =0; $i<count($invoice);$i++)
{
$item = $invoice[$i];
JFilterOutput::objectHtmlSafe($item);
?>
<tr>
<td>
<?php 
echo "COMPANY";
echo "<br/>";
echo $item->company;
 ?>
</td>
<td>
<?php
echo "BILL TO <br/>";
echo $item->name ."<br/>";
echo $item->email."<br/>";
echo $item->localtion."<br/>";
echo "<br/>";
echo "<br/>";
?>
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0" class="contentpane">
  <tr>
    <th width="5%" ><?php echo JText::_('NUM')?></th>
    <th width="10%" ><?php echo JText::_('INVOICE ID') ?></th>
    <th ><?php echo JText::_('PRODUCT TYPE') ?></th>
    <th width="20%"><?php echo JText::_('AMOUNT') ?></th>
    <th width="20%"><?php echo JText::_('DATE') ?></th>
  </tr>
  <?php
  $total_in=0;
  $total_out=0;
  for($k=0;$k<count($item->transactions);$k++)
  {
	  	$transaction = $item->transactions[$k];
	   ?>
	  <tr>
	    <td align="center" width="5%"> <?php echo $transaction->transaction_id ?></td>
	    <td align="center" width="10%"><?php echo $transaction->invoice_id ?></td>
	    <td align="center"><?php echo $transaction->product_type ?></td>
	    <td align="center" width="20%"><?php echo $transaction->amount ?></td>
	    <td align="center" width="20%"><?php echo $transaction->date ?></td>
	  </tr>
	  <?php
	  if($transaction->amount > 0)
	  {
	  	$total_in +=$transaction->amount;
	  }
	  else 
	  {
	  	$total_out +=$transaction->amount;
	  }
  }
  ?>
  </table>
  <br />
  <table width="100%">
  <tr>
  <td colspan="4" align="center" width="100%">
  Total income : <?php echo $total_in; ?> ---------------------Total expense <?php echo $total_out ;?>
  <br />
  <hr />
  </td>
  </tr>
</table>

</td>
</tr>
<?php
}
?>
<input type="hidden" name="view" value="jatransactions">
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="">
<input type="hidden" name="cid" value="<?php echo $this->ids?>">
</form>
</table>